﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AgorApp.Roma.ServiceContracts
{
    /// <summary>
    /// Interfaccia per la base dei services
    /// che definisce le operazioni CRUD
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IBaseService<T, Key> : IDisposable
        where T : class,new()
        where Key : struct
    {

        #region Direct Methods
        ICollection<T> GetAll();

        T Get(Key key);

        void Insert(T entity);

        void Update(T entity);

        void Delete(T entity);
        #endregion

        #region Async Methods
        Task<ICollection<T>> GetAllAsync();

        Task<T> GetAsync(Key key);

        Task InsertAsync(T entity);

        Task UpdateAsync(T entity);

        Task DeleteAsync(T entity);
        #endregion
    }
}
